package com.eduhzy.ttw.work.di.module;

import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.eduhzy.ttw.work.mvp.contract.CheckWorkContract;
import com.eduhzy.ttw.work.mvp.model.CheckWorkModel;
import com.eduhzy.ttw.work.mvp.model.entity.WorkDetailData;
import com.eduhzy.ttw.work.mvp.ui.adapter.WorkFileAdapter;
import com.jess.arms.di.scope.ActivityScope;

import java.util.ArrayList;
import java.util.List;

import dagger.Module;
import dagger.Provides;

/**
 * @author xubo
 * @date 2018-12-3 17:45:21
 */
@Module
public class CheckWorkModule {
    private CheckWorkContract.View view;

    /**
     * 构建CheckWorkModule时,将View的实现类传进来,这样就可以提供View的实现类给presenter
     *
     * @param view
     */
    public CheckWorkModule(CheckWorkContract.View view) {
        this.view = view;
    }

    @ActivityScope
    @Provides
    CheckWorkContract.View provideCheckWorkView() {
        return this.view;
    }

    @ActivityScope
    @Provides
    CheckWorkContract.Model provideCheckWorkModel(CheckWorkModel model) {
        return model;
    }

    @ActivityScope
    @Provides
    WorkFileAdapter providerAdapter(List<WorkDetailData.FileListBean> lists) {
        return new WorkFileAdapter(lists);
    }

    @ActivityScope
    @Provides
    List<WorkDetailData.FileListBean> provideLists() {
        return new ArrayList<>();
    }
    @ActivityScope
    @Provides
    RecyclerView.LayoutManager provideLayoutManager() {
        return new GridLayoutManager(view.getActivity(), 4);
    }
}